package com.code.domain;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.processors.DefaultValueProcessor;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.jar.JarEntry;

public  class GpmartUtil {

    /**
     * 处理分页
     * @return
     */
    public static Integer PageBefore(Integer pageSize,Integer limit){
        Integer result  = (pageSize-1)*limit;
        return result;
    }

    /**
     * 处理json返回内容
     * @param brandList
     * @param count
     * @return
     */
    public static JSONObject layJson(List<Map<String,Object>> brandList, Integer count){
        JSONObject jo = new JSONObject();
        JSONArray ja = JSONArray.fromObject(brandList);
        jo.accumulate("msg","");
        jo.accumulate("code","0");
        jo.accumulate("count",count);
        jo.accumulate("data",ja);
        return jo;
    }


}
